import router from './index'
import store from '../store'
import Config from '@/config'
import { getToken } from '@/global/storage'

router.beforeEach(async (to, from, next) => {
  if (to.name) {
    document.title = to.name + ' - ' + Config.appName
  }
  next()
  /* let token = getToken()
  if (token) {
    // 初始化用户信息
    await store.dispatch('user/setUser')
    // 路由跳转
    if (to.matched.length === 0) {
      next('/404')
    } else if (to.path === '/login') {
      next('/')
    } else {
      next()
    }
  } else {
    if (to.path === '/login') {
      next()
    } else {
      next('/login')
    }
  } */
})
